package com.ms.service.module.fish.message.server;

import java.nio.ByteBuffer;
import java.util.List;

import com.ms.service.module.fish.db.UsrGameLog;
import com.ms.service.module.fish.game.GameConf;
import com.ms.service.module.fish.game.GameUser;
import com.ms.service.module.fish.message.FishBaseMessage;

/**
 * 捕多个鱼207
 * @author cuiwm
 */
public class MultCatchMessage extends FishBaseMessage {
	
    private String uid;
    private int bullet;
    private List<UsrGameLog> logs;
    private GameUser gameUser;
    
    public MultCatchMessage(String uid,int bullet,List<UsrGameLog> logs,GameUser gameUser) {
    	this.setUid(uid);
    	this.setBullet(bullet);
    	this.setLogs(logs);
    	this.gameUser = gameUser;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public int getBullet() {
		return bullet;
	}

	public void setBullet(int bullet) {
		this.bullet = bullet;
	}

	public List<UsrGameLog> getLogs() {
		return logs;
	}

	public void setLogs(List<UsrGameLog> logs) {
		this.logs = logs;
	}

	@Override
	public void writeBody(ByteBuffer buf) {
		writeString(buf, uid);
		buf.put((byte) bullet);
		buf.putInt(logs.size());
		for(UsrGameLog log:logs){
			buf.putInt(log.getScriptId());
			buf.putInt(log.getAddCoin());
			buf.putInt(log.getRate());
			buf.putInt(log.orate());
			buf.putInt(log.yrate());
		}
		
		if(gameUser == null) {
			buf.put((byte) 0);
			buf.putInt(0);
			buf.put((byte) 0);
		}else {
			buf.put((byte) gameUser.getLastShell());
			buf.putInt(GameConf.getSpecialBullet(gameUser.getLastShell()).getLimitTime());
			buf.put((byte) gameUser.getLastShellNum());
		}
	}


}